package com.practice.agObjectAndClass007.clone;

import java.util.Date;

public class OriginalClass implements Cloneable {
    String name;

    Date date;

    public OriginalClass() {
    }

    public OriginalClass(String name) {
        this.name = name;
    }

    public OriginalClass(String name, Date date) {
        this.name = name;
        this.date = date;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static void main(String[] args) {
        OriginalClass originalClass = new OriginalClass();
        originalClass.setName("yangdj");
        System.out.println(originalClass.getName());
        try {
            // 对象克隆时有可能报不支持clone的异常
            Object cloneClass = originalClass.clone();

            System.out.println(cloneClass.getClass());
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
    }
}
